<template>
  <div class="h-full w-[100%]">
    <!-- 状态 -->
    <div class="flex h-[120px] mt-[30px] ml-[10px] mr-[10px]">
      <div class="flex h-[100%] rlq_info_box w-[100%]">
        <div
          v-for="(item, index) in rlDL"
          :key="index"
          class="rlq_info text-center flex-1"
        >
          <div :class="getClassColor(index)">
            {{ item.deviceName || "" }}
          </div>
        </div>
      </div>
    </div>
    <!-- 数据 -->
    <div class="ml-[5px] mr-[5px] flex h-[190px] hjjl_info_box mt-[0px]">
      <div class="hjjl_info text-center" style="flex: 1.3">
        <div>铁水产品</div>
        <div>{{ activeData?.L5 || "-" }}</div>
      </div>
      <div class="hjjl_info_center text-center flex-1">
        <div>{{ activeData?.L6 || "" }}</div>
      </div>
      <div class="hjjl_info text-center" style="flex: 1.3">
        <div>下炉产品</div>
        <div>{{ activeData?.L7 || "-" }}</div>
      </div>
    </div>
    <div class="flex zxcx-card">
      <div>造型当前节拍</div>
      <div>{{ activeData?.L8 || "-" }}</div>
      <div>秒</div>
    </div>
    <!-- <p class="jzcp">造型当前节拍：{{ zxcsData?.modelBeatNow || "-" }}秒</p> -->
    <!-- 表格1 -->
    <el-table
      class="top-table selectOption"
      border
      :data="tableData1"
      style="
        width: calc(100% - 40px);
        margin: 40px auto 20px;
        --el-table-border-color: none;
        --el-table-bg-color: none;
        --el-table-tr-bg-color: none;
      "
      :row-class-name="tableRowClassName"
      :cell-style="{
        color: '#FFFFFF',
        'text-align': 'center',
        'font-family': 'DINPro',
      }"
      :header-cell-style="{
        backgroundColor: 'transparent !important',
        backgroundRepeat: 'no-repeat',
        backgroundPosition: 'center',
        backgroundSize: 'auto',
      }"
    >
      <el-table-column label="铁水批次" width="120">
        <template #default="">{{ activeData?.L9 || "" }}</template>
      </el-table-column>
      <el-table-column label="出铁温度℃">
        <template #default=""
          >{{ activeData?.L10 || "-" }}
          <span class="pl-[8px] pr-[8px]">|</span>
          <span class="green-color">{{ activeData?.L11 || "-" }}</span>
        </template>
      </el-table-column>
      <el-table-column label="取样温度℃">
        <template #default=""
          >{{ activeData?.L12 || "-" }}
          <span class="pl-[8px] pr-[8px]">|</span>
          <span class="green-color">{{ activeData?.L13 || "-" }}</span>
        </template>
      </el-table-column>
    </el-table>
    <!-- 表格2 -->
    <el-table
      class="top-table selectOption"
      border
      :data="tableData1"
      style="
        width: calc(100% - 40px);
        margin: 30px auto;
        --el-table-border-color: none;
        --el-table-bg-color: none;
        --el-table-tr-bg-color: none;
      "
      :row-class-name="tableRowClassName"
      :cell-style="{
        color: '#FFFFFF',
        'text-align': 'center',
        'font-family': 'DINPro',
      }"
      :header-cell-style="{
        backgroundColor: 'transparent !important',
        backgroundRepeat: 'no-repeat',
        backgroundPosition: 'center',
        backgroundSize: 'auto',
      }"
    >
      <el-table-column label="包次" width="110">
        <template #default="">{{ activeData?.L14 || "" }} </template>
      </el-table-column>
      <el-table-column label="出铁时间">
        <template #default="">{{ activeData?.L15 || "-" }} 秒</template>
      </el-table-column>
      <el-table-column label="出水重量KG">
        <template #default=""
          >{{ activeData?.L16 || "-" }}
          <span class="pl-[8px] pr-[8px]">|</span>
          <span class="green-color">{{ activeData?.L17 || "-" }}</span>
        </template>
      </el-table-column>
      <el-table-column label="出铁实际时间" width="160">
        <template #default=""
          ><span class="green-color"
            >{{ activeData?.L18 || "-" }} 秒</span
          ></template
        >
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup lang="ts">
defineOptions({
  name: "DATASCREENRL02JZQ",
  inheritAttrs: false,
});

const props = defineProps({
  rlSCWL: {
    type: Object,
    default: () => {},
  },
  rlPC: {
    type: Object,
    default: () => {},
  },
  zxcsData: {
    type: Object,
    default: () => {},
  },
  activeData: {
    type: Object,
    default: () => {},
  },
  refreshRate: {
    type: Number,
    default: () => 0,
  },
});

const emit = defineEmits(["get-info"]);
const { rlPC, activeData, zxcsData, refreshRate } = toRefs(props);
const rlDL = ref([
  {
    deviceName: "1#电炉",
  },
  {
    deviceName: "2#电炉",
  },
  {
    deviceName: "3#电炉",
  },
  {
    deviceName: "4#电炉",
  },
]);
const tableData1 = ref([{}]);
const tableData2 = ref([
  { name: "包首温度", unit: "℃" },
  { name: "包尾温度", unit: "℃" },
  { name: "球化时间", unit: "秒" },
  { name: "包浇注时间", unit: "秒" },
  { name: "模浇注重量", unit: "KG" },
]);
const tableData3 = ref([{}]);
const tableData4 = ref([{}]);
// 行样式解析
function tableRowClassName(rowIndex: any) {
  if (rowIndex.rowIndex % 2 != 0) {
    return "evenRow";
  }
  // return "oddRow";
  return "evenRow";
}

function getClassColor(index: any) {
  // if (index + 1 == activeData.value[`L${index + 1}`]) {
  //   return "green_back";
  // } else {
  if (activeData.value[`L${index + 1}`] == 1) {
    return "green_back";
  }
  if (activeData.value[`L${index + 1}`] == 2) {
    return "white_back";
  }
  if (activeData.value[`L${index + 1}`] == 3) {
    return "grey_back";
  }
  // }
}
onMounted(() => {});

onBeforeUnmount(() => {});
</script>

<style lang="scss" scoped>
// 整体表格样式
:deep(.el-table) {
  thead {
    background: rgba(2, 79, 173, 0.3);
    .cell {
      font-size: 19px;
      line-height: 32px;
      writing-mode: horizontal-tb;
      word-spacing: 0px;
      writing-mode: horizontal-tb;
      text-orientation: upright;
      color: transparent;
      background: linear-gradient(
          0deg,
          rgb(88, 175, 255) 0px,
          rgb(255, 255, 255) 100%
        )
        text;
      clip-path: inset(1px);
      padding: 0 6px;
    }

    tr:nth-last-child(1) {
      border-right: none;
    }
  }
  tbody {
    tr {
      height: 50px;
      .cell {
        font-size: 18px;
        line-height: 28px;
        padding: 0 6px;
      }
    }
    tr:hover {
      background-color: rgb(55, 90, 136) !important;
    }
    td.el-table__cell {
      background-color: transparent !important;
      border: none !important;
    }
  }

  .el-table__empty-text {
    color: rgb(199, 228, 240);
    font-size: 24px;
    line-height: 200px;
  }
}
// 单行样式
:deep(.evenRow) {
  background: rgba(15, 36, 62, 0.6);
  td {
    .cell {
      // color: rgb(104, 201, 240);
      color: rgb(168, 190, 216);
    }
  }
}

// 双行样式
:deep(.oddRow) {
  background: rgba(10, 24, 42, 0.6);
  td {
    .cell {
      color: rgb(168, 190, 216);
    }
  }
}

.jzcp {
  text-align: center;
  font-size: 27px;
  color: #fff;
  margin-bottom: -10px;
  font-family: YOUSHE;
  margin-top: 15px;
  color: transparent;
  background: linear-gradient(0deg, rgb(1, 94, 234) 0px, rgb(0, 192, 250) 100%)
    text;
  user-select: text;
  color: rgba(255, 255, 255, 0.8);
}

:deep(.syt_chart) {
  thead {
    .cell {
      font-size: 19px !important;
      line-height: 20px;
    }
  }
  tbody {
    tr {
      .cell {
        padding: 0 1px !important;
      }
    }
  }
}

.green-color {
  color: #2ffff3 !important;
}
.green_back {
  background-color: #1de9b6 !important;
  width: 100%;
  color: #2f4f4f !important;
}
.red_back {
  background-color: red;
  width: 100%;
  color: #fff !important;
}
.grey_back {
  background-color: rgba(255, 255, 255, 0.1);
  width: 100%;
  color: #fff !important;
}

.white_back {
  width: 100%;
  color: #fff !important;
  background: linear-gradient(
    0deg,
    rgba(1, 94, 234, 0.8) 0px,
    rgba(0, 192, 250, 0.2) 100%
  );
}

.border-box-content1 {
  background-image: url("@/assets/images/screen/preview (1).png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.hjjl_info_box {
  background-image: url("@/assets/images/screen/preview (6).png");
  // background-size: 35%;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  margin-bottom: 10px;
  .hjjl_info {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: center;
    div:nth-child(1) {
      writing-mode: horizontal-tb;
      word-spacing: 0px;
      letter-spacing: 0px;
      text-orientation: upright;

      user-select: text;
      font-size: 20px;
      font-family: YOUSHE;
      margin-top: -15px;
      color: transparent;
      background: linear-gradient(
          0deg,
          rgb(1, 94, 234) 0px,
          rgb(0, 192, 250) 100%
        )
        text;
    }
    div:nth-child(2) {
      writing-mode: horizontal-tb;
      word-spacing: 0px;
      letter-spacing: 0px;
      text-orientation: upright;
      color: transparent;
      background: linear-gradient(
          0deg,
          rgb(1, 94, 234) 0px,
          rgb(0, 192, 250) 100%
        )
        text;
      user-select: text;
      font-family: YOUSHE;
      font-size: 22px;
      line-height: 22px;
      color: rgba(255, 255, 255, 1);
    }
  }
  .hjjl_info_center {
    justify-content: center;
    align-items: center;
    div {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100%;
      margin-top: 0px;
      writing-mode: horizontal-tb;
      text-orientation: upright;
      color: rgb(255, 255, 255);
      filter: drop-shadow(rgba(0, 11, 27, 0.66) 1px 1px 0px)
        drop-shadow(rgb(95, 159, 255) 2px 1px 16px);
      user-select: text;
      font-family: YOUSHE;
      font-size: 30px;
      margin-top: -10px;
    }
  }
}

.rlq_info_box {
  align-items: center;
  justify-content: center;
  display: flex;
  .rlq_info {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 90px;
    justify-content: center;
    margin: 5px;
    div:nth-child(1) {
      writing-mode: horizontal-tb;
      word-spacing: 0px;
      letter-spacing: 0px;
      text-orientation: upright;
      color: rgba(255, 255, 255, 0.9);
      user-select: text;
      font-size: 24px;
      line-height: 90px;
      font-family: YOUSHE;
    }
  }
}
.zxcx-card {
  height: 100px;
  width: auto;
  height: 100px;
  margin: 0 20px;
  margin-top: 10px;
  // background: url("@/assets/images/screen/preview (7).png") center center / 100%
  //   100% no-repeat;
  background: url("@/assets/images/screen/preview (1).png") center center / 100%
    100% no-repeat;
  padding: 0 65px;
  border-radius: 4px;
  writing-mode: horizontal-tb;
  text-orientation: upright;
  color: rgb(255, 255, 255);
  filter: drop-shadow(rgba(0, 11, 27, 0.66) 1px 1px 0px)
    drop-shadow(rgb(95, 159, 255) 2px 1px 0px);
  user-select: text;
  div:nth-child(1) {
    writing-mode: horizontal-tb;
    word-spacing: 0px;
    letter-spacing: 0px;
    text-orientation: upright;
    color: rgba(255, 255, 255, 0.95);
    user-select: text;
    font-size: 26px;
    font-family: YOUSHE;
    flex: 1.4;
    line-height: 110px;
  }
  div:nth-child(2) {
    writing-mode: horizontal-tb;
    word-spacing: 0px;
    letter-spacing: 0px;
    text-orientation: upright;
    color: transparent;
    background: linear-gradient(
        0deg,
        rgb(1, 94, 234) 0px,
        rgb(0, 192, 250) 100%
      )
      text;
    user-select: text;
    font-family: YOUSHE;
    font-size: 54px;
    line-height: 100px;
    flex: 1.8;
    text-align: right;
  }
  div:nth-child(3) {
    color: rgba(255, 255, 255, 0.95);
    font-family: YOUSHE;
    flex: 0.4;
    line-height: 110px;
    text-align: right;
    font-size: 18px;
  }
}
</style>
